|
1. | For instance, if you assign an integral value to a floating-point variable, the compiler will automatically convert the int to a float. |
| 例如,假设我们为浮点变量分配一个整数值,计算机会将int自动转换成float。 |
|
|
| |
2. | Type, such as float, can be specified. |
| 液位。可以指定类型,例如浮子式。 |
|
|
| |
3. | }float naturalLogBase() { return 2.718f; |
| }float naturalLogBase() { return 2.718; |
|
|
| |
4. | So the answer is that casting from a float or double to an integral value always truncates. |
| 所以答案就是:将一个float或double值造型成整数值后,总是将小数部分“砍掉”,不作任何进位处理。 |
|
|
| |
5. | 3、 为什么潜水艇既能浮在水面,又能潜入水底? |
| Why can a submarine float and sink? |
|
|
| |
6. | if you multiply a float and a double, the result will be double; |
| 若将一个float值与一个double值相乘,结果就是double; |
|
|
| |
7. | Drag onto the page, then right-click to specify type, such as float. |
| 拖到绘图页上,然后右击指定类型,如浮子式。 |
|
|
| |
8. | That is, you can do anything with a BigInteger or BigDecimal that you can with an int or float, it's just that you must use method calls instead of operators. |
| 也就是说,能对int或float做的事情,对BigInteger和BigDecimal一样可以做。 只是必须使用方法调用,不能使用运算符。 |
|
|
| |
9. | However, with float f4 = 1e-47f; |
| 然而,对于下述语句:float f4 = 1e-47f; |
|
|
| |
10. | Upper or lowercase L means long, upper or lowercase F means float and upper or lowercase D means double. |
| 若为大写或小写的L,代表long; 大写或小写的F,代表float; 大写或小写的D,则代表double。 |
|
|
| |